package entitys;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table( name="tbl_pet" )
public class Pet implements Serializable {
	private static final long serialVersionUID = -4598310238894168258L;
	private Long id;
	private String name;
	private Food food;
	
	public Pet() {

	}
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Cascade(value = { CascadeType.ALL })
	@OneToOne
	public Food getFood() {
		return food;
	}
	
	public void setFood(Food food) {
		this.food = food;
	}
	
	@Override
	public String toString() {
		return "[PET: ID=>"+this.getId()+", NAME=>"+this.getName()+", FOOD: "+this.getFood()+"]";
	}
}
